package com.warren.ioc;

import com.warren.beans.factory.config.BeanPostProcessor;
import com.warren.error.BeansException;

/**
 * @author warren
 * @create 2021-08-20 13:49
 * @Description
 */
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if ("userService".equals(beanName)) {
            UserService userService = (UserService) bean;
            //userService.setLocation("改为：北京");
        }
        return bean;
    }


    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }
}
